package com.sh.代理模式.静态代理.impl;

import com.sh.代理模式.静态代理.OrderService;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class OrderServiceProxy implements OrderService {

    private OrderServiceImpl orderService;

    public OrderServiceProxy() {
    }

    public OrderServiceProxy(OrderServiceImpl orderService) {
        this.orderService = orderService;
    }

    @Override
    public void generate() {
        long begin = System.currentTimeMillis();
        // 执行目标对象的目标方法
        orderService.generate();
        long end = System.currentTimeMillis();
        System.out.println("耗时"+(end - begin)+"毫秒");
    }

    @Override
    public void detail() {
        long begin = System.currentTimeMillis();
        // 执行目标对象的目标方法
        orderService.detail();
        long end = System.currentTimeMillis();
        System.out.println("耗时"+(end - begin)+"毫秒");
    }

    @Override
    public void modify() {
        long begin = System.currentTimeMillis();
        // 执行目标对象的目标方法
        orderService.modify();
        long end = System.currentTimeMillis();
        System.out.println("耗时"+(end - begin)+"毫秒");
    }
}

